package com.llyb.service;

import org.springframework.ai.tool.annotation.Tool;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public class Chatrecord {


    @Tool(description = "用于获取学生信息")
    private List<Student> getStudent(String sex){
        List<Student> studnetData = getStudnetData();
        return studnetData.stream().
                filter(student -> student.sex.equalsIgnoreCase(sex)).
                collect(Collectors.toList());
    }


    private List<Student> getStudnetData(){
        ArrayList<Student> list = new ArrayList<>();
        list.add(new Student(1L,"zhangsan","男",1L));
        list.add(new Student(2L, "lisi", "女", 1L));
        list.add(new Student(3L, "wangwu", "男", 2L));
        list.add(new Student(4L, "zhaoliu", "女", 3L));
        list.add(new Student(5L, "qianqi", "男", 2L));

        return list;
    }

    record Student(Long id,String name,String sex,Long classId){}
}
